package com.community.controller;

import com.community.base.BaseController;
import com.community.common.Const;
import com.community.common.ServerResponse;
import org.springframework.web.bind.annotation.*;

/**
 * 事件产生控制层
 */
@RestController
@RequestMapping("/remindController/")
@CrossOrigin(origins = Const.REQUESTURL,maxAge = 3600,allowCredentials = "true")
public class RemindController extends BaseController {


    /**
     * 新增事件
     * @param beUser 被提醒用户名
     * @param messageType 消息类型（1:公告,2:提醒,3:私信）
     * @param eventType 事件类型(详情见枚举type:eventType,catalog:remind)
     * @param eventUser 事件产生用户名
     * @param target  提醒的动作作用对象(详情见Const.RemindTarget)
     * @param targetId 提醒的动作作用对象id
     * @return
     */
    @PostMapping("addRemind.do")
    public ServerResponse<String> addRemind(@RequestParam(value = "beUser") String beUser,
                                            @RequestParam(value = "messageType") int messageType,
                                            @RequestParam(value = "eventType") int eventType,
                                            @RequestParam(value = "eventUser") String eventUser,
                                            @RequestParam(value = "target") int target,
                                            @RequestParam(value = "targetId") int targetId){
        return iRemindService.addRemind(beUser,messageType,eventType,eventUser,target,targetId);
    }
}
